#1 条件判断
score = 59
if score > 100 or score < 0:
    pass # pass空语句，用于占位
else:
    if score >= 80:
        print("Good")
    elif score >= 60:
        print("OK")
    else:
        print("Bad")
# Bad

#2 循环
# for循环
for i1 in 'hello':
    print(i1, end=',')
# h,e,l,l,o,
print() # 换行

for i2 in range(1,11):
    print(i2, end=',')
# 1,2,3,4,5,6,7,8,9,10,
print()

# (for...else, break) 案例——密码验证
def comsumer_login():
    for i3 in range(3):
        user_name = input('请输入用户名：')
        user_password = input('请输入密码：')
        if user_name == 'zw' and user_password == '555555':
            print('系统正在登录，请稍后...')
            break
        else:
            if i3 < 2:
                print('用户名或密码不正确，您还有', 2 - i3, '次机会')
    else:
        print('三次均输入错误！')

# comsumer_login()

# while循环
sum4 = 0
i4 = 0
while i4 <= 100:
    sum4 += i4
    i4 += 1
print('1-100和是：', sum4)
# 1-100和是： 5050

# (continue) 案例——计算1-100之间的偶数和
sum5 = 0
i5 = 0
while i5 <= 100:
    i5 += 1
    if i5 % 2 == 1:
        continue
    sum5 += i5
print('1-100之间的偶数和是：', sum5)
# 1-100之间的偶数和是： 2550

#3 随机数生成
import random
print(random.randint(1, 100))